﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="scheduler_mySch_edit.aspx.cs" Inherits="Ccit.OA.Scheduler.scheduler_mySch_edit" %>
<%@ Register TagPrefix="ccit" Namespace="Ccit.ServerControls" Assembly="Ccit.ServerControls.ActionForm" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>日程管理</title>
           <script language="javascript" type="text/javascript" src="../script/jquery.js"></script>
    <script language="javascript" type="text/javascript" src="../script/StringClass_Ext.js"></script>
    <script language="javascript" type="text/javascript" src="../script/jsonlib.js"></script>
    <script language="javascript" src="../script/jwindow.js" type="text/javascript"></script>
    <script language="javascript" src="../script/jcontrol.js" type="text/javascript"></script>
    <script language="javascript" src="../script/jbase64.js" type="text/javascript"></script>
    <script language="javascript" src="../scheduler/calendar/wpCalendar.js" type="text/javascript"></script>
    
    <script type="text/javascript">
    
      function pageLoad() {
      }
      
      function doSave()
      {
        if(document.getElementById('RCBT').value == "")
        {
            alert('标题不允许为空!');
            document.getElementById('RCBT').focus();
            return false;
        }
        if(document.getElementById('stada').value == "" || document.getElementById('endda').value == "")
        {
            alert('日程的开始日期或结束日期不允许为空!');
            return false;
        }
        
	    if (!LKSYS_CheckTime(document.getElementById("staTime").value,false))
	    {
		    alert("请输入合法时间!");
		    document.getElementById("staTime").focus();
		    return false;
	    }
	    if (!LKSYS_CheckTime(document.getElementById("endTime").value,false))
	    {
		    alert("请输入合法时间!");
		    document.getElementById("endTime").focus();
		    return false;
	    }
        
        if(document.getElementById('RCNR').value == "" )
        {
            alert('日程内容不允许为空!');
            return false;
        }
        else if(document.getElementById('RCNR').value.length > 500)
        {
            alert('日程内容最多只允许输入500个字符!');
            return false;
        }
        if(document.getElementById('tbtqdate').value != "")
        {
            IsNumeric();
        }
        //全天事件为false时
        if(document.getElementById("cb_qtsj").checked == false)
        {
            if(document.getElementById("staTime").value == "" || document.getElementById("endTime").value == "")
            {
                alert("开始时间与结束时间不允许为空!");
                return false;
            } 
        }
        
        if(document.getElementById("rddlrc").checked == true)
        {
            if(document.getElementById("ddlrxz") != null)
            {
                if(document.getElementById("ddlrxz").options[document.getElementById("ddlrxz").selectedIndex].value == "0" || document.getElementById("ddlrxz").options[document.getElementById("ddlrxz").selectedIndex].value == "")
                {
                    alert("请选择代理人!");
                    return false;
                }
            }
        }
        return true;
        
      }
      
      
    function LKSYS_CheckTime(pTime,pShowMsg) 
    { 
	    var ResultOK = null; 

	    /*-- 时间格式：(两位)小时 + (两位)分钟 --*/ 
	    /*-- 分割符号：":" --*/ 
	    var RegTime = /\d{2}:{1}\d{1,2}/; 

	    /*-- 用正则表达式判断格式 --*/ 
	    ResultOK = RegTime.test(pTime); 

	    /*-- 处理并返回结果 --*/ 
	    if(!ResultOK) 
	    { 
		    if(pShowMsg) 
		    {
			    alert("非法时间：时间格式错误,应为HH:MM型！"); 
		    }
		    return false; 
	    } 

	    /*-- 检查小时和分钟是否超过可能的最大值 --*/ 
	    var mHour = 0;
	    var mMinute = 0;
	    var iPos1 = 0;
	    var iPos2 = 0;
	    var sTime = pTime.toString(); 
	    var mSepChar = ":";

	    /*-- 提取时间的值 --*/ 
	    iPos1 = sTime.indexOf(mSepChar);
    	
	    mHour = sTime.substring(0,iPos1); 
	    if (sTime.substring(iPos1+1,iPos1+2)=="0")
	    {
		    mMinute = sTime.substr(iPos1+2);
	    }
	    else
	    {
		    mMinute = sTime.substr(iPos1+1);
	    }    
    	
	    /*-- 判断小时是否超出范围 --*/ 
	    if(mHour < 0 || mHour >= 24) 
	    { 
		    if(pShowMsg) alert("非法时间：小时过小或者过大，超出限制 (0-23)！");
		    return false;
	    } 

	    /*-- 判断分钟 --*/ 
	    if(mMinute < 0 || mMinute > 59) 
	    { 
		    if(pShowMsg) alert("非法时间：没有这个时间！");
		    return false; 
	    }

	    /*-- 格式和值均正确，返回真 --*/ 
	    return true; 
    } 			  
      
      
    function IsNumeric()
    {
        //判断是否为整数
        var pattern =/^([0-9])+$/;   
        var flag   =   pattern.test(document.getElementById('tbtqdate').value);
        if(flag == false)
        {
            alert('此处只允许输入数字！');
            document.getElementById('tbtqdate').value = "";
            document.getElementById('tbtqdate').focus();
            return false;
        }   
        //return true;
     }
     
     function doradio()
     {
    
        if(document.getElementById("rdgrrc").checked == true)
        {
            document.getElementById("CJYH").style.display = "none";
            document.getElementById("tddlr").innerHTML = ""; 
        }
        else if(document.getElementById("rddlrc").checked == true)
        {
            document.getElementById("CJYH").style.display = "block";
            document.getElementById("tddlr").innerHTML = "选择被代理人";
        }
        
     }
     
     function doback()
     {
        window.history.go(-1);
     }
     
     function doALLDayClick()
     {
        if(document.getElementById("cb_qtsj").checked == true)
        {
            document.getElementById("tr3").style.display = "none";
        }
        else{
            document.getElementById("tr3").style.display = "block";
        }
     }
    </script>
</head>
<body>
    <ccit:ActionForm id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server" />
	    <table class="tbToolbar" cellSpacing="0" cellPadding="0" width="98%" align="center" border="0">
		<tr>
			<td align="left">
				<div class="tbSeparator"></div>
			</td>
			<td id="Td1" class="titlebar" width="100%" runat="server">我<nobr>的日程 </nobr>
			</td>
		</tr>
	</table>
		<!--从此开始为编辑页面正文内框部分-->
		<table class="tableborder" cellSpacing="0" cellPadding="0" width="98%" align="center">
			<tr>
					<td class="pformleft" align="center" width="100">日程类型</td>
					<td class="pformrightline" id="RCLB" width="40%" runat="server"><input onclick="doradio()" type="radio" checked id="rdgrrc" runat="server" />个人日程&nbsp;&nbsp;&nbsp;&nbsp;<input onclick="doradio()" type="radio" id="rddlrc" runat="server" />代理日程 </td>
					<td class="pformleft" align="center" width="100" runat="server" id="tddlr"></td>
					<td class="pformright" id="CJYH" width="35%" runat="server" ><asp:DropDownList  Width="200px"  ID="ddlrxz" runat="server" ></asp:DropDownList></norb>
					</td>
				</tr>
			<tr>
				<td class="pformleft" align="center">标&nbsp;&nbsp;&nbsp;&nbsp;题</td>
				<td class="pformrightline" colSpan="3"><input class="input" id="RCBT" style="WIDTH: 100%" type="text" maxLength="100" runat="server">
				</td>
			</tr>
			<tr>
			    <td class="pformleft" align="center">地点</td>
				<td class="pformrightline"><INPUT class="input" id="txtaddrass" style="WIDTH: 200px" type="text" runat="server">
				</td>
				<td class="pformleft" align="center">日程分类</td>
				
				<td class="pformright"><asp:DropDownList ID="ddschtype" Width="200px" runat="server"></asp:DropDownList>
				</td>
			</tr>
			<tr id="tr1" runat="server">
				<td class="pformleft" align="center">开始日期</td>
				<td class="pformrightline"><INPUT class="input" id="stada" style="WIDTH: 200px" type="text" name="stada" runat="server">
					<IMG class="getdate" id="IMG1" title="选择日期" src="../images/toolbar/Calendar.gif" relaobj="stada">
				</td>
				<td class="pformleft" align="center">结束日期</td>
				<td><INPUT class="input" id="endda" style="WIDTH: 200px" type="text" name="endda" runat="server">
					<IMG class="getdate" id="IMG2" title="选择日期" src="../images/toolbar/Calendar.gif" relaobj="endda">
				</td>
			</tr>
			<tr id="tr3" runat="server">
				<td class="pformleft" align="center">开始时间</td>
				<td class="pformrightline"><INPUT class="input" id="staTime" style="WIDTH: 200px" type="text" name="stada" runat="server">
				</td>
				<td class="pformleft" align="center">结束时间</td>
				<td><INPUT class="input" id="endTime" style="WIDTH: 200px" type="text" name="endda" runat="server">
				</td>
			</tr>
			<tr id="tr2" runat="server">
				<td class="pformleft" align="center">人员当时状态</td>
				<td class="pformright"><asp:DropDownList  Width="200px"  ID="ddrydszt" runat="server"  CssClass="select"></asp:DropDownList>
				</td>
				<td class="pformleft">&nbsp;
                    </td>
				<td class="pformright">
                    <asp:CheckBox ID="cb_qtsj" runat="server" Text="全天事件" />&nbsp;&nbsp;&nbsp;&nbsp;<asp:CheckBox Text="私人日程" ID="cb_srrc" runat="server" /></td>
			</tr>
			<tr>
				<td class="pformleft" align="center">内&nbsp;&nbsp;&nbsp;&nbsp;容</td>
				<td class="pformright" colSpan="3"><textarea class="textinput" id="RCNR" maxLength="20" style="WIDTH: 100%"  rows="9" runat="server"></textarea></td>
			</tr>
			<tr>
				<td class="pformleft" align="center">完成标志</td>
				<td class="pformrightline" align="left"><asp:radiobuttonlist id="WCBZ" CssClass="radio" RepeatDirection="Horizontal" Runat="server">
						<asp:ListItem Selected="True" Value="0">未完成</asp:ListItem>
						<asp:ListItem Value="1">已完成</asp:ListItem>
					</asp:radiobuttonlist></td>
				<td class="pformleft" align="center">创建时间</td>
				<td class="pformright"><asp:textbox id="txtCreateTime" Width="95%" CssClass="inputreadonly" Runat="server" ReadOnly="True"></asp:textbox></td>
			</tr>
			<tr style="display:none">
				<td class="pformleft" align="center">提醒方式</td>
				<td class="pformrightline" align="left"><asp:CheckBoxList ID="cb_txfs" 
                        runat="server" RepeatDirection="Horizontal">
				<asp:ListItem Text="在线消息" Value="1"></asp:ListItem>
				<asp:ListItem Text="即时通讯" Value="2"></asp:ListItem>
				<asp:ListItem Text="手机短信" Value="3"></asp:ListItem>
				</asp:CheckBoxList></td>
				<td class="pformleft" align="center">提前</td>
				<td class="pformright"> <asp:TextBox ID="tbtqdate" runat="server"></asp:TextBox>&nbsp;
				<asp:DropDownList ID="ddtqdatetype" runat="server">
				    <asp:ListItem Text="分钟" Value="1"></asp:ListItem>
				    <asp:ListItem Text="小时" Value="2"></asp:ListItem>
				    <asp:ListItem Text="天" Value="3"></asp:ListItem>
				</asp:DropDownList></td>
			</tr>
			<tr>
				<td class="pformstrip" align="center" colSpan="4"><asp:button id="btnSave" 
                        runat="server" CssClass="button" Text="保存" onclick="btnSave_Click"></asp:button>
                    <asp:button id="btnCancel" runat="server" CssClass="button" Text="保存返回" 
                        onclick="btnCancel_Click"></asp:button>&nbsp;<asp:Button ID="btnback" 
                        CssClass="button"  Text="返回" runat="server" onclick="btnback_Click" Visible="false"/><input class="button" type="button" id="btncancel1" value="返回" onclick="doback()" runat="server" />&nbsp;</td>
			</tr>
		</table>
	    <input type="hidden" id="hidCarId"  runat="server"/>
    </ccit:ActionForm>
    <script language="javascript">
         //document.getElementById("CJYH").style.display = "none";
         //document.getElementById("tddlr").innerHTML = ""; 
    </script>
</body>
</html>
